package cn.cdeden.knowledge.mapper;


import cn.cdeden.knowledge.domain.PersonalFilesTree;
import cn.cdeden.knowledge.domain.TeamFilesTree;
import cn.cdeden.knowledge.domain.TeamRelevanceRole;
import cn.cdeden.knowledge.domain.dto.FilesTree;
import cn.cdeden.knowledge.domain.dto.SearchFilesInfoDto;
import cn.cdeden.knowledge.domain.dto.TeamFilesTreeQueryParam;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
* @author Chen
* @date 2022-09-16
*/
@Repository
public interface TeamFilesTreeMapper extends BaseMapper<TeamFilesTree> {
    List<TeamFilesTree> selectSuperiorAll(String id);

    List<TeamFilesTree> selectJuniorAll(@Param("id") String id,@Param("b") boolean b);


    /**
     * 查询所有子目录
     * @param ids
     * @return
     */
    List<TeamFilesTree> selectJuniorAll02(@Param("ids") List<String> ids,@Param("deleteType") String deleteType);



    List<TeamFilesTree> selectListTreePage(@Param("parentId") String parentId,@Param("realName") String realName, @Param("teamId") String teamId, @Param("teamRelevanceRoleList") List<TeamRelevanceRole> teamRelevanceRoleList, @Param("startPage") Integer startPage, @Param("endPage") Integer endPage,@Param("deleteId") boolean deleteId, @Param("sortAsc") String sortAsc, @Param("sortDesc") String sortDesc, @Param("sort")List<String> sort, @Param("deleteType")String deleteType);
    Integer selectListTreePageCount(@Param("parentId") String parentId,@Param("realName") String realName,@Param("deleteId") boolean deleteId,@Param("teamId") String teamId, @Param("teamRelevanceRoleList") List<TeamRelevanceRole> teamRelevanceRoleList);

    List<String> getByPatentId(String id);

    List<TeamFilesTree> getFolderByParentId(String parentId, String teamId, List<TeamRelevanceRole> teamRelevanceRoleList, List<String> sort);

    IPage<TeamFilesTree> selectTreePage(@Param("query") TeamFilesTreeQueryParam query, IPage<PersonalFilesTree> page, @Param("teamRelevanceRoleList") List<TeamRelevanceRole> teamRelevanceRoleList);

    int selectByIdTreePageInfo(String treeId, String parentId, int size, List<String> sort, List<TeamRelevanceRole> teamRelevanceRoleList);

    List<TeamFilesTree> selectAllSubordinate(@Param("ids")String ids, @Param("userId")String userId, @Param("b") Boolean b);

    IPage<FilesTree> SearchTeamFileTreeByLabelPage(@Param("query") SearchFilesInfoDto infoDto, @Param("queryPage")IPage queryPage, @Param("teamRelevanceRoleList") List<TeamRelevanceRole> teamRelevanceRoleList);

    IPage<FilesTree> SearchTeamFileTreePage(@Param("query")SearchFilesInfoDto infoDto, @Param("queryPage")IPage queryPage,@Param("teamRelevanceRoleList") List<TeamRelevanceRole> teamRelevanceRoleList);

    List<TeamFilesTree> nameRecheckingVerifyData(String parentId);

}
